<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/material_media/image-upload/style.css">
{extend name="public/base" /}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
<link rel="stylesheet" href="__PUBLIC__/admin/material/css/index.css?v=111141&times=111" />
<link rel="stylesheet" href="__PUBLIC__/admin/material_media/css/index.css?v=111141" />
<link rel="stylesheet" href="__PUBLIC__/admin/material/css/iconfont.css" />
<link rel="stylesheet" href="__PUBLIC__/admin/material/css/tooltipify.css">
</link>
<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
<link rel="stylesheet" href="__PUBLIC__/admin/upload_layui/css/index.css">
<link href="/public/plugs/editor/css/toastr.min.css" rel="stylesheet">
{include file="material/_ali_icon" /}

<style>
	.main-box-body .navs .active {
		background: azure;
		color: #03a9f4;
		border: 1px solid #03a9f4;
		border-radius: 5px;
	}

	a {
		color: #777;
		text-decoration: none;
	}

	a:hover {
		text-decoration: none
	}

	.table tbody>tr>td {
		padding: 0px 8px;
	}

	.table-hover>tbody>tr:nth-child(odd) {
		background-color: #f9f9f9;
	}

	.table-responsive {
		min-height: 470px;
	}
</style>

<style>
	#sidebar-nav .nav>.open .submenu>li>.submenu a:before,
	#sidebar-nav .nav>.active .submenu>li>.submenu a:before {
		content: "";
	}
</style>
<style>
	.uploadify-button-text {
		position: relative;
		display: inline-block;
		cursor: pointer;
		background: #fff;
		padding: 0px 5px;
		color: #333;
		text-align: center;
		border-radius: 3px;
		overflow: hidden;
		border: 1px solid #ccc;
	}

	em {
		color: red;
	}

	.tiktok .panel-body i {
		display: block;
		height: 20px;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		word-break: break-all;
		width: 100%;
		margin: 0 auto;
	}
</style>
{/block}
{block name="body"}

<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-right">
			{if checkAuthRule('del')}<button type="button" class="btn btn-warning"> <input class="checkbox check-all"
					type="checkbox" style="display: inline-block;margin-top: -2px;vertical-align: middle;"> 全选
			</button>{/if}
			<button type="button" class="btn btn-success " id="lower">下放</button>
			<button type="button" class="btn btn-primary" id="createUrl">
				<i class="fa fa-plus"></i> 添加视频<span class="caret"></span>
			</button>
			{if checkAuthRule('del')}<button class="btn btn-danger ajax-post confirm" url="{:url('del_my')}"
				target-form="ids">删 除</button>{/if}
		</div>
		<div class="row">
			<form method="get">

				{include file="material_media/_search2" /}
			</form>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<!-- 搜索相关 -->
		{include file="material/_search" /}
		<!-- 如果是爆款文案 -->
		{include file="material/_search_hot" /}
		<div id="" class="clear"></div>

		{empty name="list"}
		{/empty}

		<div class="tiktok">
			<div class="row toolTip">
				{volist name="list" id="vo"}
				<div class="col-md-2">
					<div class="panel panel-default">
						<div class="panel-body">
							<i style="font-style: normal;">{$vo.title}</i>
							<video src="{$vo.content}" controls poster="{$vo.cover}"></video>
							<div class="num">{$vo.score}</div>
							<input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}">

							<!-- 过稿功能 + 上报公众库 -->
							<div class="setting">
								<div onclick="change_status({$vo.id})">
									{if $vo['status'] == 0}
									<span style="font-size: 19px;" class="iconfont icon-duigou"></span>
									{else/}
									<span style="font-size: 19px;" class="iconfont icon-duigou-copy"></span>
									{/if}
								</div>
								<div style="margin-top: 10px; padding-right: 0px;" onclick="upload(this, {$vo['id']})"
									id="upload_id_{$vo['id']}" data-json='{:json_encode($vo)}'>
									{if $vo['is_upload']}<i class="iconfont icon-shangchuan1-copy"></i>{else/}<i
										class="iconfont icon-shangchuan1"></i>{/if}
								</div>
							</div>
						</div>
						<div class="panel-footer" style="flex-direction: column;padding: 3px 9px;">
							<div style="width: 100%;justify-content: space-between;color: #b1b0b0;">
								<span
									style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;width: 220px;flex:1">
									ID:{$vo['id']} {if $vo['is_distribution'] == 1}
									<span style="color: #e84e40;">{$userlist[$vo['uid']]??$vo['uid']}</span>
									{else/}
									{$userlist[$vo['uid']]??$vo['uid']}
									{/if}

								</span>
								<span> {$vo['show_time']}</span>
							</div>
						</div>
						<div class="panel-footer" style="border-top: initial;">
							<div style="flex: 1;width:0;margin-right: 5px;">
								<!-- <span class="title">{$vo.id}</span> -->
								<span style="color: #e84e409c" title="量级">{$vo['magnitude_num_zh']}</span>
							</div>
							<div>
								<span>{$vo.book_id_zh}</span>
								<div onclick="editreferral(this)" data-json='{:json_encode($vo)}'>&nbsp;修改</div>
								<div class="downLoad" onclick="downMedia('{$vo.content}',{$vo.id})">
									<button type="button" class="btn btn-danger btn-sm" target="_blank"
										href="{$vo.content}">
										<i style="color:#fff" class="iconfont icon-xiazai-wenjianxiazai-16"></i>
									</button>
									(<span class="copyNum">{$vo['copy_click_num']}</span>)
								</div>

							</div>
						</div>
					</div>

				</div>
				{/volist}
			</div>
		</div>
		{$page}
	</div>
</div>

<div class="modal fade" id="create-referral-link-modal">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
						aria-hidden="true">×</span></button>
				<span style="font-size: 20px;"><span id="referralname">添加</span></span>
			</div>
			<div class="modal-body">
				<div data-bind="visible: loading" class="loading-panel" style="display: none;">
					<i class="fa fa-spin fa-spinner"></i>
				</div>
				<form class="form-horizontal modelform">
					{include file="material_media/_from" /}
					<div class="form-group">
						<label class="control-label col-sm-2">标题</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" id="video_title" name="title" value=""
								placeholder="多个文件时以英文,分开" />
						</div>
					</div>
					<!-- 图片无编辑器，所以默认加上这2个参数 -->
					<input type="hidden" name="is_edit" value="2">
					<input type="hidden" name="update_time" value="{:time()}">

					<!--头部，相册选择和格式选择-->
					<div class="form-group">
						<label class="control-label col-sm-2">视频</label>
						<input type="hidden" name="content" id="video_content">
						<!-- <input type="hidden" class="layui-input content" name="title" id="video_title"> -->
						<input type="hidden" class="layui-input content" name="cover" id="video_cover">
						<div class="col-lg-9">
							<button type="button" class="btn btn-primary" id="video_btn">上传</button>
							<div class="layui-upload-list">

							</div>
							<table></table>
						</div>
					</div>

				</form>
			</div>
			<div class="modal-footer">
				<button type="button" id="createreferral" class="btn btn-primary ">提交</button>
			</div>
		</div>
	</div>
</div>

{include file="adsmaterialbook/_from" /}
{/block}
{block name="script"}
<script src="__PUBLIC__/admin/material/js/jquery-tooltipify.min.js"></script>
<script src="/public/plugs/editor/toastr.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
<script src="__PUBLIC__/plugs/moment/moment.min.js"></script>
<script src="__PUBLIC__/plugs/moment/zh-cn.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/layer/layer.js"></script>
<script type="text/javascript">

	$(function () {
		$('#createUrl').on('click', function () {
			var is_rule = '{:checkAuthRule("add")}';
			if (!is_rule) {
				layer.msg("你没权限添加");
				return;
			}
			var $modal = $('#create-referral-link-modal');
			$modal.on('shown.bs.modal', function () {
				//默认选择内部
				multipleInput('3'.split(','), $("input:checkbox[name=hot]"));
				// uploader();
			});
			$modal.modal({backdrop: 'static', keyboard: false});
		});
		$("#createreferral").on('click', function () {
			var data = $('.modelform').serializeJson();
			console.log(data);
			if (data['content'].length == 0 && $("#field_ebook").val() == '') {
				updateAlert("不能为空", 'danger');
				return false;
			}
			var url = "{:url('add_my')}";
			$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType: "json",
				success: function (data) {
					if (data.code == 1) {
						updateAlert(data.msg, 'success');
						setTimeout(function () {
							window.location.reload();
						}, 100);
					} else {
						updateAlert("添加，" + data.msg, 'danger');
					}
				},
				error: function (e) {
					console.log(e.status);
					console.log(e.responseText);
				}
			})
		});
	});


	$('.panel-body .show').click(function () {
		$(this).parent().parent().siblings().show()
	})
	$('.mask i').click(function () {
		$(this).parent().hide()
	})

</script>
{include file="material/pub_footer"}
{include file="material_media/_pub_upload"}
{/block}